package com.migu.contacts.bean;

import com.migu.contacts.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class UserScoreBean {

    public double score;
    public Map<String, Integer> loginStatus;
    public List<ScoreSettingList> scoreSettingList;
    public List<ProductScoreList> productScoreList;

    public String getScore() {
        return String.valueOf((long) score);
    }

    public Map<Integer, String> mapping = new HashMap<Integer, String>() {{
        put(1, "one");
        put(2, "two");
        put(3, "three");
        put(4, "four");
        put(5, "five");
        put(6, "six");
        put(7, "seven");
    }};

    public List<LoginStatus> getLoginStatus() {
        List<LoginStatus> res = new ArrayList<>();
        if (loginStatus == null) {
            return res;
        }
        for (int i = 1; i <= 7; i++) {
            LoginStatus status = new LoginStatus();
            status.day = i;
            Integer s = loginStatus.get(mapping.get(i));
            if (s != null) {
                status.status = s;
            }
            res.add(status);
        }
        return res;
    }

    public static class LoginStatus {
        public int day;
        public int status;
        //        Value值 0=未登录  1=已登录 2=未来日期（优先判断2）
    }

    //1=邀请赠送 2=新增人脉卡 3=每日登录
    public static class ScoreSettingList {
        public int type;
        public double score;

        public int getIcon() {
            if (type == 1) {
                return R.drawable.score_friend;
            }
            return R.drawable.score_add;
        }

        public String getType() {
            if (type == 1) {
                return "邀请好友赚积分";
            }
            if (type == 2) {
                return "新增人脉卡送积分+10";
            }
            if (type == 3) {
                return "每日登录";
            }
            return "";
        }

        public String getWork() {
            if (type == 1) {
                return "去邀请";
            }
            if (type == 2) {
                return "去新增";
            }
            if (type == 3) {
                return "去登录";
            }
            return "";
        }

        public String getScore() {
            return (long) score + "";
        }
    }

    public static class ProductScoreList {
        public int id;
        public String name;
        public double score;

        public String getScore() {
            return (long) score + "";
        }
    }
}
